package com.hllxd.hism.star.basic.service.service;

import com.hllxd.hism.star.basic.service.collect.DateUtils;
import com.hllxd.hism.star.basic.service.dao.mapper.mis.NegativeFeedbackMapper;
import com.hllxd.hism.star.basic.service.model.TblDataRockNegativeFeedback;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wuguangxi
 * @description
 * @date 2023/12/27 15:11
 **/
@Slf4j
@Service("negativeFeedService")
public class NegativeFeedbackServiceImpl implements NegativeFeedbackService {

    @Autowired
    private NegativeFeedbackMapper mapper;

    @Override
    public void save(TblDataRockNegativeFeedback negativeFeedback) {
        negativeFeedback.setCreateTime(DateUtils.getDateTime());
        negativeFeedback.setActionTime(DateUtils.getDateTime());
        mapper.save(negativeFeedback);
    }

    @Override
    public void modify(TblDataRockNegativeFeedback negativeFeedback) {
        negativeFeedback.setActionTime(DateUtils.getDateTime());
        mapper.update(negativeFeedback);
    }

    @Override
    public List<TblDataRockNegativeFeedback> findAll() {
        return mapper.findAll();
    }

    @Override
    public TblDataRockNegativeFeedback findById(Integer id) {
        if(id == null){
            return null;
        }
        return mapper.findById(id);
    }

    @Override
    public void delete(Integer id) {
        if(id == null){
            return;
        }
        mapper.delete(id);
    }
}
